package com.itboye.jmsfhz.data.presenter;

import java.util.List;
import java.util.Observer;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.jmsfhz.app.ui.main.MainPresenter;
import com.itboye.jmsfhz.data.interfaces.IRedBag;
import com.itboye.jmsfhz.data.model.PersonDataBean;
import com.itboye.jmsfhz.data.model.RecruitBean;
import com.itboye.jmsfhz.data.model.RedBagModel;
import com.itboye.jmsfhz.data.repository.BaseRepository;
import com.itboye.jmsfhz.data.repository.RedBagRepository;

public class RedBagPresenter extends BasePresenter implements
		IRedBag<RecruitBean> {
	//就业
		public static final String jiuye=MainPresenter.class
				.getName() + "_Updatepsw_fail";
		public static final String UpdatePswByPwdSuccessEvent=MainPresenter.class
				.getName() + "_Updatepsw_success";
		
		//就业
				public static final String shousuo=MainPresenter.class
						.getName() + "_shousuo_fail";
				public static final String shousuoSuccessEvent=MainPresenter.class
						.getName() + "_shousuo_success";

	public RedBagPresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(RecruitBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(RecruitBean model) {
		// TODO Auto-generated method stub
		IRedBag<RecruitBean> redBag = new RedBagRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						result.setEventTag(Tag_Success);
						result.setEventType(shousuo);
						RedBagPresenter.this.setChanged();
						RedBagPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(shousuoSuccessEvent);
						RedBagPresenter.this.setChanged();
						RedBagPresenter.this.notifyObservers(result);
					}
				});
		redBag.add(model);
	}

	@Override
	public void update(RecruitBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void getInfo(RecruitBean model) {
		// TODO Auto-generated method stub
		IRedBag<RecruitBean> redBag = new RedBagRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						result.setEventTag(Tag_Success);
						result.setEventType(jiuye);
						RedBagPresenter.this.setChanged();
						RedBagPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(shousuoSuccessEvent);
						RedBagPresenter.this.setChanged();
						RedBagPresenter.this.notifyObservers(result);
					}
				});
		redBag.getInfo(model);
	}

	@Override
	public List<RecruitBean> query(RecruitBean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void getkeywords(String page_num, String page_size, String keywords) {
		// TODO Auto-generated method stub
		IRedBag<RecruitBean> redBag = new RedBagRepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						result.setEventTag(Tag_Success);
						result.setEventType(shousuo);
						RedBagPresenter.this.setChanged();
						RedBagPresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						result.setEventTag(Tag_Success);
						result.setEventType(shousuoSuccessEvent);
						RedBagPresenter.this.setChanged();
						RedBagPresenter.this.notifyObservers(result);
					}
				});
		redBag.getkeywords(page_num, page_size, keywords);
	}


}
